package com.service.impl;

import com.dao.ProductMapper;
import com.pojo.Product;
import com.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    ProductMapper productMapper;

    @Override
    public List<Product> selectAllProducts() {
        return productMapper.selectAllProducts();
    }

    @Override
    public int addProduct(Product product) {
        return productMapper.addProduct(product);
    }

    @Override
    public int deleteProductById(Integer id) {
        return productMapper.deleteProductById(id);
    }

    @Override
    public int updateProductById(Product product) {
        return productMapper.updateProductById(product);
    }

    @Override
    public List<Product> selectProsByName(String name,String ctgname) {
        return productMapper.selectProsByName(name,ctgname);
    }

    @Override
    public List<Product> selectProsByCtg(String ctgname) {
        return productMapper.selectProsByCtg(ctgname);
    }

}
